#pragma once

#include "cImgInterectionDect.h"

const int HISTOGRAM_VALUE = 255;
const int HOR_SPLIT_THRESHOLD = 2;
const double LINE_A_RELATIVEPOSITION = 0.0;
const double LINE_B_RELATIVEPOSITION = 0.132840;
const double LINE_C_RELATIVEPOSITOIN = 0.12950;
const double LINE_D_RELATIVEPOSITION = 0.0750;
const double LINE_E_RELATIVEPOSITION = 0.1300;
const double LINE_F_RELATIVEPOSITION = 0.1350;
const double LINE_G_RELATIVEPOSITION = 0.1350;
const double LINE_H_RELATIVEPOSITION = 0.1350;
const double LINE_I_RELATIVEPOSITION = 0.1350;
const double HORHISTOGRAM_THRESHOLD_1 = 0.40; 
const double HORHISTOGRAM_THRESHOLD_2 = 0.60;
const int    ADAPTIVETHRESHOLD_BLOCKSIZE = 35;
const int    ADAPTIVETHRESHOLD_CONSTANT = -5;

class cLPSplit : public cImgInterectionDect
{
public:
	Mat maskedImg;

public:
	cLPSplit(void);
	cLPSplit(const string &filename);
	cLPSplit(const Mat &sourceImg);

	std::vector<Mat> horSplit();

	~cLPSplit(void);

private:
	int *getHorHistogram (const Mat &srcMat);
	int *getVertHistogram(const Mat &srcMat);
	int *getHorSplitLine(std::vector<Vec2f> &possibleSplits);
	std::vector<Vec2f> findPossibleHorSplits(const int *horHistogram,int arrayLength);
	Mat doAdaptiveThreshold(const Mat &sourceImg);
};

